export class Loading {
  constructor() {

    this.loadingDom = document.getElementById("comLoading")
    this.loadingText = document.getElementById("loadingText")
    this.defaultLoadingText = ""
    this.isLoading = true
  }
  static getInstance() {
      if( !Loading.instance ) {
        Loading.instance = new Loading()
      }
      return Loading.instance
  }

  showLoading(
    loadingText = ""
  ) {
    this.loadingDom.style.display = "block"
    this.loadingText.innerText = loadingText
    this.isLoading = true
  }

  hideLoading() {
    this.loadingDom.style.display = "none"
    this.loadingText.innerText = ""
    this.isLoading = false
  }

  destory() {
    this.loadingDom = null
  }
}
